<?php

namespace App\Observers;

use App\Http\Controllers\Seckill;
use App\Models\GrSeckill;

class SeckillObserver
{
    /**
     * Handle the GrSeckill "created" event.
     *
     * @param \App\Models\GrSeckill $grSeckill
     * @return void
     */
    public function created(GrSeckill $grSeckill)
    {
        $seckillId = $grSeckill->seckill_id;
        $goods_count = $grSeckill->limit_number;
        $endTime = $grSeckill->seckill_end_time;
        $startTime = $grSeckill->seckill_start_time;
        $model = new Seckill();
        $model->seckillPreheat($seckillId, $goods_count, $startTime, $endTime);
    }

    /**
     * Handle the GrSeckill "updated" event.
     *
     * @param \App\Models\GrSeckill $grSeckill
     * @return void
     */
    public function updated(GrSeckill $grSeckill)
    {
        //
    }

    /**
     * Handle the GrSeckill "deleted" event.
     *
     * @param \App\Models\GrSeckill $grSeckill
     * @return void
     */
    public function deleted(GrSeckill $grSeckill)
    {
        //
    }

    /**
     * Handle the GrSeckill "restored" event.
     *
     * @param \App\Models\GrSeckill $grSeckill
     * @return void
     */
    public function restored(GrSeckill $grSeckill)
    {
        //
    }

    /**
     * Handle the GrSeckill "force deleted" event.
     *
     * @param \App\Models\GrSeckill $grSeckill
     * @return void
     */
    public function forceDeleted(GrSeckill $grSeckill)
    {
        //
    }
}
